#OBJS specifies which files to compile as part of the project 

Source := $(wildcard *.cpp) 
OBJS =  $(Source:.cpp=.o)
#CC specifies which compiler we're using 
CC = g++ 
#COMPILER_FLAGS specifies the additional compilation options we're using 
# -w suppresses all warnings 


PathGLUpc:=$(shell locate glu.pc)


GLUFLAGS:=$(shell pkg-config --cflags glu)


GLULIBS:=$(shell pkg-config --libs glu)

PathSDLpc:=$(shell locate sdl.pc)

SDLFLAGS:=$(shell pkg-config --cflags sdl)

SDLLIBS:=$(shell pkg-config --libs sdl)




COMPILER_FLAGS =-c -Wall
DEBUG= -g -Wall 
#LINKER_FLAGS specifies the libraries we're linking against 
LINKER_FLAGS =$(SDLLIBS)$(GLULIBS)-lglut -lSDL_image -lSDL_ttf -lSDL_mixer
#OBJ_NAME specifies the name of our exectuable 
Name = mygame 
#This is the target that compiles our executable 
all: $(Name) 


$(Name): $(OBJS)
	$(CXX) $(OBJS) -o $@ $(LINKER_FLAGS)

%.o: %.cpp
	$(CXX) $(COMPILER_FLAGS) $< -o $@
	
clean:
	@- $(RM) $(Name)
	@- $(RM) $(OBJS)
debug:clean
	$(CXX) $(DEBUG) $(Source) $(LINKER_FLAGS) -o $(Name)
	@- gdb $(Name)
	@- $(RM) $(Name)
	@- $(RM) $(OBJS)	
	@- make	
#LINKER_FLAGS specifies the libraries we're linking against 
